package xiaohu.day3.HJ33;

import java.util.Scanner;

public class Main2
{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String[] split = scanner.nextLine().split("\\.");
            Long num = Long.valueOf(scanner.nextLine());
            // ip转成整数、按位或
            System.out.println(Long.valueOf(split[0]) <<24 |
                    Long.valueOf(split[1]) << 16 |
                    Long.valueOf(split[2]) << 8 |
                    Long.valueOf(split[3]));

            // 整数转成ip
            System.out.println(((num >> 24) & 255)+"."
            +((num >> 16) & 255)+"."
            +((num >> 8) & 255)+"."
            +(num & 255));
        }
    }
}
